<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<%@ include file="/WEB-INF/page/include.inc.jsp"%>
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/styles/plugins/jqPagination/jqpagination.css"></link>
	<script type="text/javascript" src="<%=request.getContextPath()%>/styles/plugins/jqPagination/jquery.jqpagination.min.js"></script>
	
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/styles/table.css"></link>
	<script type="text/javascript" src="<%=request.getContextPath()%>/styles/table.js"></script>
	
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/styles/jquery.autocomplete.css"></link>
	<script type="text/javascript" src="<%=request.getContextPath()%>/styles/jquery.autocomplete.js"></script>
	
	<script>
		$(document).ready(function() {
			$('.pagination').jqPagination({
				current_page: '${page.currentPage}',
				max_page	: '${page.pageCount}',
				page_string : '${page.currentPage}/${page.pageCount}',
				paged		: function(page) {
					$("#currentPage").val(page);
					$("#start").val((page - 1) * 10);
					$("#formId").submit();
				}
			});
			
			loadName();
		});
		
		function loadName(){
		    $("#name").AutoComplete({
		        'data': "<%=request.getContextPath()%>/system/operator/loadName.html",
		        'emphasis': false,
		        'width': 'auto',
		        'onerror': function(msg){alert(msg);}
		    });
		}
		
		function exp() {
			$("#formId").append("<input type='hidden' id='isExport' name='isExport' value='1'/>");
			$("#formId").submit();
			$("#isExport").val(null);
		}
	</script>
</head>

<body>
	<div id="ssm-page">
		<form id="formId" action="list" method="post">
			<fieldset>
				<legend>查询条件</legend>
				<input id="currentPage" type="hidden" name="currentPage" value="1"/>
				<input id="start" type="hidden" name="start" value="0"/>
				<span>用户名:</span><input type="text" id="id" name="id" value="${operator.id}"/>
				<span>姓名:</span><input type="text" id="name" name="name" value="${operator.name}"/>
				<input id="search" type="submit" class="button" value="查询"/>
			</fieldset>
		</form>
		<div id="buttons">
			<input class="button" type="button" value="新增" onclick="self.top.addTab('新增操作员','<%=request.getContextPath()%>/system/operator/toAdd','');"/>
			<input class="button" type="button" value="删除" onclick="del('delete');"/>
			<input class="button" type="button" value="上传" onclick="self.top.addTab('上传操作员','<%=request.getContextPath()%>/system/operator/toUpload','');"/>
			<input class="button" type="button" value="导入" onclick="self.top.addTab('导入操作员','<%=request.getContextPath()%>/system/operator/toImport','');"/>
			<input class="button" type="button" value="导出" onclick="exp();"/>
		</div>
		<table id="tableId">
			<tr>
				<th><input type="checkbox" id="checkAll" onclick="checkAll()"/></th>
				<th>用户名</th>
				<th>姓名</th>
				<th>性别</th>
				<th>出生日期</th>
				<th>状态</th>
				<th>住址</th>
				<th>手机</th>
				<th>电话</th>
				<th>创建人</th>
				<th>创建时间</th>
				<th>登录次数</th>
				<th>操作</th>
			</tr>
			<c:forEach items="${page.record}" var="operator">
				<tr>
					<td><input type="checkbox" name="checkboxs" value="${operator.id}"/></td>
					<td>${operator.id}</td>
					<td>${operator.name}</td>
					<td>
						<c:if test="${operator.sex==1}">男</c:if>
						<c:if test="${operator.sex==2}">女</c:if>
					</td>
					<td><fmt:formatDate value="${operator.birthDate}" pattern="yyyy/MM/dd"/></td>
					<td>
						<c:if test="${operator.state==1}">正常</c:if>
						<c:if test="${operator.state==2}">异常</c:if>
					</td>
					<td>${operator.address}</td>
					<td>${operator.mobile}</td>
					<td>${operator.phone}</td>
					<td>${operator.creater}</td>
					<td><fmt:formatDate value="${operator.createTime}" pattern="yyyy/MM/dd HH:mm:ss"/></td>
					<td>${operator.loginCount}</td>
					<td>
						<a href="javascript:void(0)" onclick="self.parent.addTab('修改操作员', '<%=request.getContextPath()%>/system/operator/toUpdate?operatorId=${operator.id}','')">修改</a>
						<a href="javascript:void(0)" onclick="self.parent.addTab('操作员详情', '<%=request.getContextPath()%>/system/operator/getDetail?operatorId=${operator.id}','')">详情</a>
					</td>
				</tr>
			</c:forEach>
		</table>
		
		<div class="pagination" style="width: 100%">
			<a href="#" class="first" data-action="first">&laquo;</a>
			<a href="#" class="previous" data-action="previous">&lsaquo;</a>
			<input type="text" readonly="readonly" />
			<a href="#" class="next" data-action="next">&rsaquo;</a>
			<a href="#" class="last" data-action="last">&raquo;</a>
			显示${page.currentPage}-${page.pageSize}   共${page.count}
		</div>
	</div>
</body>
</html>
